const downloadBtn = document.getElementById('download-btn');
const outputBox = document.getElementById('input');

downloadBtn.addEventListener('click', function() {
    // 获取输出框内容
    const content = outputBox.value;
    // 弹出输入框
    let fileName = prompt('请输入文件名', '');
    // 检查输入框是否为空
    if (!fileName ) {
        alert('文件名不能为空');
        return;
    }

    // 创建Blob对象
    const blob = new Blob([content], {type: 'text/plain'});

    // 创建a标签
    const link = document.createElement('a');
    link.href = URL.createObjectURL(blob);
    link.download = fileName;

    // 触发a标签的点击事件
    link.click();
});




